<template>
	<view class="detailed">
		<view class="navList">
			<view :class="isActive == index ?'navitem active':'navitem'" v-for="(item,index) in navlist" :key="index"
				@click="ChangeNav(index)">
				{{item}}
			</view>
		</view>

	</view>
</template>

<script>
	export default {
		props: {
			navlist: {
				type: Array,
				default () {
					return [0, 0, 0]
				}
			}
		},
		data() {
			return {
				isActive: 0
			}
		},

		methods: {
			ChangeNav(index) {
				this.isActive = index
				this.$emit('chooseNav', this.isActive)
			}
		}
	}
</script>

<style lang="scss">
	.navList {
		display: flex;
		background-color: #1E293B;
		color: #fff;

		.navitem {
			flex: 1;
			text-align: center;
			padding: 10px;
			box-sizing: border-box;
		}

		.active {
			color: #7687D1;
			border-bottom: 2px solid #7687D1;
		}
	}
</style>